import logging.handlers
def Longgin_Init(filename):
    logger = logging.getLogger()
    logger.setLevel(logging.INFO)
    st = logging.StreamHandler()
    fh = logging.handlers.TimedRotatingFileHandler(filename,when='midnight',
                                                   interval=1,backupCount=7,
                                                   encoding='utf8')
    fmt = "%(asctime)s %(levelname)s [%(filename)s (%(funcName)s :%(lineno)d] - %(message)s "
    format = logging.Formatter(fmt)
    st.setFormatter(format)
    fh.setFormatter(format)
    logger.addHandler(st)
    logger.addHandler(fh)